//
//  CallNotesModel.swift
//  GLUZSwift
//
//  Created by xyanl on 2025/3/17.
//  Copyright © 2025 考拉🐨. All rights reserved.
//

import UIKit

class CallNotesModel: BaseModel {
    var roomId: String = ""
    /// 通话时长，分钟
    var callDuration: String = ""
    /// 通话支付积分
    var callTimePrice: Int = 0
    /// 翻译客服人数
    var translatorCount: Int = 0
    /// 翻译客服人员列表
    var translatorList: [CallNotesTranslatorModel] = []
    
    /// 观看人数
    var viewCount: Int = 0
    /// 申请连麦人数
    var applyCount: Int = 0
    /// 1v1预约人数
    var reservationCount: Int = 0
    
}

class CallNotesTranslatorModel: BaseModel {
    var userId: Int = 0
    var name: String = ""
    var nameRu: String = ""
    /// 通话时长
    var translateDuration: Int = 0
    /// 翻译服务积分
    var translatePrice: String = ""
    
    // 评分
    var rating: Int = 1
    
    var ratingList: [BaseUIModel] = []

    override func didFinishMapping() {
        ratingList = CallNotesTranslatorModel.evaluateData(rating: 1)
    }
    
    static func evaluateData(rating: Int) -> [BaseUIModel] {
        var eva = rating
        
        if rating <= 1 {
            eva = 1
        }
        if rating > 5 {
            eva = 5
        }
        var arr: [[String: Any]] = []
        switch eva {
        case 0, 1:
            arr = [
                [ "title": "服务体验差", "imageName": "ic_callNotes_0"],
                [ "title": "翻译错误", "imageName": "ic_callNotes_0" ],
                [ "title": "时间观念差", "imageName": "ic_callNotes_0"]
            ]
        case 2, 3:
            arr = [
                [ "title": "服务一般", "imageName": "ic_callNotes_1" ],
                [ "title": "翻译精准", "imageName": "ic_callNotes_1"],
                [ "title": "稍稍迟到", "imageName": "ic_callNotes_1"]
            ]
        case 4, 5:
            arr = [
                [ "title": "服务体验好", "imageName": "ic_callNotes_2"],
                [ "title": "翻译精准", "imageName": "ic_callNotes_2"],
                [ "title": "准点守时", "imageName": "ic_callNotes_2"]
            ]
        default:
            break
        }
        return JsonUtil.modelsFromArray(arr, BaseUIModel.self)
    }
    
    
}

/**
 {
     "roomId": "call_1_1741946615021",
     "callDuration": "3",
     "callTimePrice": 120,
     "translatorCount": 2,
     "translatorList": [{
         "userId": "113",
         "name": "阿拉山口翻译员",
         "nameRu": "Переводчик Алашанькоу ",
         "translateDuration": 1,
         "translatePrice": "100"
     }, {
         "userId": "1238",
         "name": "新的翻译",
         "nameRu": "Новый перевод ",
         "translateDuration": 1,
         "translatePrice": "200"
     }]
 }
 */
